home *** CD-ROM | disk | FTP | other *** search
/ The Original Shareware 1.1 / The Original Shareware (WeMake CDs)(Volume 1.1)(CDs, Inc)(1993).iso / 16 / fpc225_3.zip / F-PCHELP.ZIP / ENVIRON.HLP < prev    next >
Text File  |  1988-07-14  |  3KB  |  88 lines

  1. \ ENVIRON.HLP   Environment manipulation words          by Tom Zimmer
  2.  
  3. evseg           ( --- n1 )
  4.         Return n1 the value of the environment segment.
  5.  
  6. envsize         ( --- n1 )
  7.         Calculate n1 the size of the environment in bytes, clipped
  8.         to about 31k bytes.
  9.  
  10. "envfind        ( a1 n1 --- n2 bool )
  11.         Search the environment for the string specified by a1,n1.
  12.         Return a boolean flag TRUE if found, and n1 the offset
  13.         into the environment where the match occured.
  14.  
  15. .env            ( --- )
  16.         Display the current contents of the environment string.
  17.  
  18. comspec$        ( --- a1 )
  19.         The handle used to hold the COMSPEC string. I.e. COMMAND.COM
  20.  
  21. comspec@        ( --- )
  22.         Read the environment string, and extrac the COMSPEC
  23.         parameter. the COMSPEC is inserted in the COMSPEC$ handle.
  24.  
  25. .comspec        ( --- )
  26.         Print the current COMSPEC.
  27.  
  28. handle me$
  29.  
  30. : me@           ( --- ) \ extract my own execution name string
  31.                 me$ dup off 2 "envfind 0=
  32.                 abort" Couldn't find my execution name."
  33.                 4 + envsize swap
  34.                 me$ dup clr-hcb >nam -rot
  35.                 do      evseg i c@l 0= ?leave
  36.                         evseg i c@l over c! 1+
  37.                         me$ c@ 1+ me$ c!
  38.                 loop    drop ;
  39.  
  40. : .me           ( --- ) me@ me$ count type ;
  41.  
  42. comment:
  43.  
  44. envsize       ( --- n1 )
  45.         Return the maximum size the environment can be in bytes.
  46.  
  47. .env          ( --- )
  48.         Print the environment string used by the system.
  49.  
  50. "envfind      ( a1 n1 --- n2 bool )
  51.         Find the string a1 n1 in the environment, returning
  52.         bool true if found, and n2 the offset into env$ where it
  53.         was found. N2 is the offset to the BEGINNING of the
  54.         string searched for.
  55.  
  56. comspec$
  57.         Storage space for the command spec string.
  58.  
  59. comspec@      ( --- )
  60.         Extract the command spec from the environment string.
  61.  
  62. .comspec      ( --- )
  63.         Print the command spec.
  64.  
  65. path$         ( --- a1 )
  66.         Storage space for the PATH string.
  67.  
  68. path@         ( --- )
  69.         Extract the PATH from the environment string.
  70.  
  71. .path         ( --- )
  72.         Print the PATH.
  73.  
  74. me$
  75.         Storage space for the execution string used to execute
  76.         this forth currently running.
  77.  
  78. me@           ( --- )
  79.         Extract the execution string from the environment, and
  80.         place it in the string ME$
  81.  
  82. .me           ( --- )
  83.         Print the execution string after extracting it.
  84.  
  85. comment;
  86.  
  87.  
  88.